<%@ page import="java.util.List" %>
<%@ page import="com.utils.failureanalysis.data.model.singleRecorder.AnalysisData" %>
<%@ page import="java.util.List" %>
<%@ page import="com.utils.failureanalysis.data.model.singleModule.CountRecorder" %>
<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2018/7/4
  Time: 23:32
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Reporter</title>
    <div id="header">

        <div id="hello">Hello ${userName}
        </div>

        <div>
            <form action="data">
                请输入测试ID： <input type="text" name="testId" value="${testId}"/>
                <input type="submit" value="提交">
            </form>
        </div>
        <div>
            <input type="button" value="收起" onclick="hideCountResultTable()"/>
        </div>

            <div id="selectFocusedModulesButton">
                <%--<%ExcelDao excelDao=new ExcelDao();excelDao.outputToExcel();%>--%>
                <input type="button" onclick="" value="导出到Excel"/>
                <%--弹框选择导出到Excel的testId，标识出已分析的--%>
                <input type="button" onclick="" value="选择关注模块"/>
                <%--弹框选择关注模块，显示出历史模块，并确认是否保存配置，如已有配置则修改配置--%>
            </div>
    </div>
    <style>
        span {
            color: red;
        }

        #header{
            margin:auto;
        }

        #header div {
            float: left;
            margin-left: 1%;
        }

        #header #selectFocusedModulesButton {
            position: absolute;
            right: 1%;
        }
    </style>
</head>
<body>
<%
    if (request.getAttribute("pathIsNullException") != null) {%>
<span>对不起，您输入的testId不存在！</span><%
    }
%>
<%--analysisDataList${analysisDataList}--%>
<%--countRecorderList${countRecorderList}--%>
<% if (request.getAttribute("countRecorderList") != null) {%>
<table id="countResultTable" border="1">
    <% List<CountRecorder> countRecorderList = (List<CountRecorder>) request.getAttribute("countRecorderList");
        for (CountRecorder countRecorder : countRecorderList) {
            // 显示详细信息
    %>
    <tr onclick="location.href='modulesDetails/<%=countRecorder.moduleName%>'">
    <tr>
        <td><%=countRecorder.getTaskId()%>
        </td>
        <td><%=countRecorder.moduleName%>
        </td>
        <td><%=countRecorder.passNum%>
        </td>
        <td><%=countRecorder.failNum%>
        </td>
    </tr>
    <%}%>
</table>
<%} %>

<table id="resultTable" border="1">
    <%
        if (request.getAttribute("analysisDataList") != null) {
            List<AnalysisData> analysisDataList = (List<AnalysisData>) request.getAttribute("analysisDataList");
            for (AnalysisData analysisData : analysisDataList) {
                //        显示详细信息
                String modify;
                String rootCause;
                String solution;
                if (analysisData.getRootCause()==null) {
                    modify = "待分析";
                    rootCause = "待分析";
                    solution = "待分析";
                } else {
                    modify = analysisData.isModify() ? "Y" : "N";
                    rootCause = analysisData.getRootCause();
                    solution = analysisData.getSolution();
                }
    %>
    <tr onclick="location.href='detail/<%=analysisData.getId()%>'">
        <td><%=analysisData.getModuleName()%>
        </td>
        <td><%=analysisData.getDate()%>
        </td>
        <td><%=analysisData.getCaseName()%>
        </td>
        <td><%=analysisData.getDetails()%>
        </td>
        <td><%=analysisData.getStackTrace()%>
        </td>
        <%--<td><%=size%></td>--%>
        <td><%=modify%>
        </td>
        <td><%=rootCause%>
        </td>
        <td><%=solution%>
        </td>
        <%--<td><%=analysisRecords.isEmpty()?"待分析":analysisRecords.get(i).isModify()%>--%>
        <%--</td>--%>
        <%--<td><%=analysisRecords.isEmpty()?"待分析":analysisRecords.get(i).getRootCause()%>--%>
        <%--</td>--%>
        <%--<td><%=analysisRecords.isEmpty()?"待分析":analysisRecords.get(i).getSolution()%>--%>
        <%--</td>--%>
    </tr>
    <%
            }
        }
    %>
</table>
<%--通过EL表达式：<br>--%>
<%--${report.size()}<br>--%>
<%--${report[0]}<br>--%>
<%--${report[1]}<br>--%>
<%--${report[2]}<br>--%>
<%--${report[3]}<br>--%>
<%--${report[4]}<br>--%>
<%--通过jsp：<br>--%>
<%--<%=request.getAttribute("report")--%>
<%--%><br>--%>
<%--&lt;%&ndash;%>
<%--List l = (List) request.getAttribute("report");--%>
<%--int size = l.size();--%>
<%--for (Object i : l) {%>--%>
<%--<%=i%><br>--%>
<%--&lt;%&ndash;%>
<%--}--%>
<%--%>--%>
<%--显示video：<br>--%>
<%--<video src="videoPath" controls="controls">--%>
<%--your browser does not support the video tag--%>
<%--</video><br>--%>
<%--显示myData：<<br>--%>
<%--${myData}--%>

</body>
<script type="text/javascript">
    function hideCountResultTable() {
        // document.getElementById("countResultTable").style.display=document.getElementById("countResultTable").style.display=='none'?'block':'none';
    }
</script>
</html>
